<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin 网站用户 iframe 框</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/Font-Awesome-master/css/font-awesome.min.css">
    <script src="/js/jquery-2.1.1.min.js"></script>
    <script src="/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
    <style>
        html{
            background-color: #fff;
        }
    </style>
</head>
<body>
<div>
    <div style="margin: 30px;">
        <button type="button" class="layui-btn layui-btn-normal">预约统计</button>
        <button type="button" class="layui-btn layui-btn-primary" lay-href="{:url('jb')}">剧本统计</button>
        <button type="button" class="layui-btn layui-btn-primary" lay-href="{:url('fx')}">分享统计</button>
    </div>
    <div style="margin: 30px;">
        <div class="layui-inline">
            <div class="layui-input-block">
                <input type="text" value="{$business}" id="business_name" placeholder="门店名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <button class="layui-btn layui-bg-blue layuiadmin-btn-useradmin" id="business_ss">
                <i class="layui-icon">&#xe615;</i>
                筛选
            </button>
        </div>
    </div>
    <div class="layui-inline" style="margin-left: 30px;">
        <div class="layui-input-inline">
            <input type="text"  value="{$time}" name="create_time" class="layui-input" id="time_time" placeholder="开始时间至结束时间">
        </div>
        <button class="layui-btn layui-bg-blue layuiadmin-btn-useradmin" id="time_ss">
            <i class="layui-icon">&#xe615;</i>
            筛选
        </button>
    </div>
    <div style="text-align: center;font-size: 12px;line-height: 30px;margin-top: 20px;">
        预约订单数：{$order_num}&nbsp&nbsp&nbsp&nbsp预约人数：{$order_rs}
    </div>
    <div>
        <div id="main" style="width: 90vw;height:600px;"></div>
    </div>
</div>
<script src="/echarts/echarts.js"></script>
<script>
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    var res = "{$res}";
    res = res.replace(/&quot/g,'"')
    res = res.replace(/;/g,'')
    res = JSON.parse(res);
    // console.log(JSON.parse(res),999);
    // 指定图表的配置项和数据
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                crossStyle: {
                    color: '#fff'
                }
            }
        },
        toolbox: {
            feature: {
                dataView: {show: true, readOnly: false},
                magicType: {show: true, type: ['line', 'bar']},
                restore: {show: true},
                saveAsImage: {show: true}
            }
        },
        legend: {
            data: ['预约订单', '预约人数']
        },
        xAxis: [
            {
                type: 'category',
                data: res.date,
                axisPointer: {
                    type: 'shadow'
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                name: '数量',
                min: 0,
                max: {$setting.max},
                interval: {$setting.fd_num},
                axisLabel: {
                    formatter: '{value}'
                }
            }
        ],
        series: [
            {
                name: '预约订单',
                type: 'bar',
                data: res.order
            },
            {
                name: '预约人数',
                type: 'bar',
                data: res.member
            }
        ]
    };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>
<script>

    layui.config({
        base: '/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload','layer','laydate'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , upload = layui.upload;
        laydate.render({
            elem: '#time_time'
            ,range: true
            ,format: 'y/M/d'
        });
        $("#business_ss").click(function(res){
            var val = $("#business_name").val();
            "{if !empty($time)}"
            location.href = "{:url('tj')}" + '?business='+val + '&time=' + "{$time}";
            "{else}"
            location.href = "{:url('tj')}" + '?business='+val;
            "{/if}"
        })
        $("#time_ss").click(function(res){
            var val = $("#time_time").val();
            "{if !empty($business)}"
            location.href = "{:url('tj')}" + '?time='+val + '&business=' + "{$business}";
            "{else}"
            location.href = "{:url('tj')}" + '?time='+val;
            "{/if}"
        })
        //自定义验证
        form.verify({
            nickname: function(value, item){ //value：表单的值、item：表单的DOM对象
                if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
                    return '用户名不能有特殊字符';
                }
                if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '用户名首尾不能出现下划线\'_\'';
                }
                if(/^\d+\d+\d$/.test(value)){
                    return '用户名不能全为数字';
                }
            }
            ,fd_number:[/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,'只支持2位小数的数字']
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]

            //确认密码
            ,repass: function(value){
                if(value !== $('#LAY_password').val()){
                    return '两次密码输入不一致';
                }
            }
        });
        $('body').on('keyup', '.icon_search_input', function(){
            var keyword  = $.trim($(this).val());
            if (!keyword) {
                $(this).closest('.icon_select_options').find('li').show();
            } else {
                $(this).closest('.icon_select_options').find('li').each(function(){
                    var className = $(this).find('i').attr('class');
                    if (className.indexOf(keyword) >=0) {
                        $(this).show()
                    } else {
                        $(this).hide()
                    }
                })
            }
        })

    })
</script>
</body>
</html>